<template>
	<view class="page flex flex-col">
		<navbar :leftText="'分润列表'" :backStatus="true"></navbar>
		<view class="flex-1 " style="background-color: #11102A;">
			<!-- 分润列表 -->
			<!-- <view> -->
			<view class="shouYiHead showLine w690">
				<up-row>
					<up-col span="4">
						<view class="text-center">收益数量</view>
					</up-col>
					<up-col span="4">
						<view class="text-center">时间</view>
					</up-col>
					<up-col span="4">
						<view class="text-center">收益说明</view>
					</up-col>
				</up-row>
			</view>
			<view class="flex flex-col" style="overflow-y: hidden;background-color: #11102A;">
				<scroll-view v-if="fenList.length>0" class="scroll-view_H w690" :style="{ height: scrollHeight}"
					scroll-y="true" @scroll="scroll">

					<up-row v-for="(item,index) in fenList" @click="goShouYiDetail(item)"
						customStyle="margin-bottom: 10px;height:100rpx;border-bottom:2rpx solid #1F1757">
						<up-col span="4">
							<view class="text-26 text-center">{{(item.profit/1000).toFixed(2)}}</view>
						</up-col>
						<up-col span="4">
							<view class="text-26 text-center">{{timeFormat(item.createTime,'yyyy-mm-dd')}}</view>
						</up-col>
						<up-col span="4">
							<view class="text-26 text-center">{{item.info || '--'}}</view>
						</up-col>
					</up-row>
				</scroll-view>
				<view v-else class="flex-center" style="margin-top: 200rpx;" :style="{ height: scrollHeight }">
					<noData :width="250" :height="250"
						:imgUrl="'http://yyx-web-oss.oss-cn-beijing.aliyuncs.com/device/kong.gif'"></noData>
				</view>
			</view>

		</view>



		<!-- </view> -->



	</view>
</template>

<script setup>
	import * as api from "@/utils/api.js"
	import {
		timeFormat
	} from 'uview-plus'
	import {
		ref,
		reactive,
		onMounted,
		inject,
		nextTick
	} from 'vue';
	import {
		onShow,
		onReachBottom
	} from '@dcloudio/uni-app';
	onShow(() => {
		// 加载分润列表
		getFenRunList()
	})
	const fenList = ref([])

	const pageNumber = ref(1);

	const pageSize = ref(30);

	// 分润总条数
	const fenListTotal = ref(0);

	// 获取收益记录
	const getFenRunList = () => {
		let e = {
			url: '/app-api/index/share-profit',
			data: {
				pageNo: pageNumber.value,
				pageSize: pageSize.value
			}
		};
		api.default.get(e).then((res) => {
			if (pageNumber.value == 1) {
				fenList.value = res.data.list;
			} else {
				fenList.value = fenList.value.concat(res.data.list);
			}

			fenListTotal.value = res.data.total



			// console.log("fenList.value", fenList.value.length);
		})
	}

	// 上拉刷新
	onReachBottom(() => {
		console.log("5555555555");
		if (fenListTotal.value > fenList.value.length) {
			pageNumber.value++;

			// 调用分润列表
			getFenRunList()
		}

	})
</script>

<style scoped>
	.shouYi {
		color: #fff;
		margin-top: 40rpx;
	}

	.shouYiHead {
		font-size: 28rpx;
		color: #5A669E;
	}

	.showLine {
		height: 80rpx;
		line-height: 80rpx;
	}

	.scroll-view_H {
		font-size: 28rpx;
		overflow: hidden;
		color: #fff;
		/* background-color: #e43; */
	}
</style>